/* 
cd /projects/hsieh_ra/import/
qstata 01_pull_append_EC.do --memsize=32

Author: Adarsh Kumar
Objective: Pull in all raw ECs for every year and append/save separately 

*/
*Set directories 
/* REDACTED 
raw_data_dir is redacted (an empty string is created instead) to avoid disclosing location of raw files*/
local raw_data_dir = ""
local import_dir = "/projects/data_p/import/"
local build_raw_dir = "/projects/data_p/build/raw/"
local import_code_dir = "/projects/hsieh_ra/import/"

*Category of vars being pulled: IDs, Sales/Receipts, VA, NAICS/SIC codes, Salaries/Wages/Payroll, Employment
*First output list of vars and labels across all years to inspect 


**Calling function in 02_ to generate Excel file of var names & labels:
/* Redaction note
The 3rd variable and the last variable in the list of do file calls below 
have been replaced with "REDACTED" below to abide by census disclosure guidelines, since they might
disclose details of raw file names/locations 
These correspond to the local variables var2 and var4 (which have also been renamed from original code files) in the 02_pull_var_names_labels.do
and 03_pull_append_wanted_vars.do code files" 
*/ 
do "`import_code_dir'02_pull_var_names_labels.do" "cmf" "REDACTED" "year_1963 year_1967 year_1972 year_1977 year_1982 year_1987 year_1992 year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"

do "`import_code_dir'02_pull_var_names_labels.do" "cfi" "REDACTED" "year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"

do "`import_code_dir'02_pull_var_names_labels.do" "ccn" "REDACTED" "year_1972 year_1977 year_1982 year_1987 year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"

do "`import_code_dir'02_pull_var_names_labels.do" "crt" "REDACTED" "year_1977 year_1982 year_1987 year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"

do "`import_code_dir'02_pull_var_names_labels.do" "csr" "REDACTED" "year_1977 year_1982 year_1987 year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"

do "`import_code_dir'02_pull_var_names_labels.do" "cut" "REDACTED" "year_1987 year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"

do "`import_code_dir'02_pull_var_names_labels.do" "cwh" "REDACTED" "year_1977 year_1982 year_1987 year_1992 year_1997 year_2002 year_2007 year_2012 year_2017" "REDACTED"



***Calling function in 03_ to pull needed vars from SAS files
do "`import_code_dir'03_pull_append_wanted_vars.do" "cmf" "REDACTED" "03_cmf" "REDACTED"

do "`import_code_dir'03_pull_append_wanted_vars.do" "cfi" "REDACTED" "04_cfi" "REDACTED"

do "`import_code_dir'03_pull_append_wanted_vars.do" "ccn" "REDACTED" "05_ccn" "REDACTED"

do "`import_code_dir'03_pull_append_wanted_vars.do" "crt" "REDACTED" "06_crt" "REDACTED"

do "`import_code_dir'03_pull_append_wanted_vars.do" "csr" "REDACTED" "07_csr" "REDACTED"

do "`import_code_dir'03_pull_append_wanted_vars.do" "cut" "REDACTED" "08_cut" "REDACTED"

do "`import_code_dir'03_pull_append_wanted_vars.do" "cwh" "REDACTED" "09_cwh" "REDACTED"

